package com.mdb.open.trade.service.trade;


/*
* Copyright (C), 2017-2019 澳发科技(MDB)
* FileName: TfLoanApplyTransportInfoService.java
* Author:   you.yichao
* Date:     2019-10-11
* History:
* <author>          <time>          <version>          <desc>
* you.yichao         2019-10-11          V1.00             代码生成器初始生成代码
* -----------------------------------------------------------
* 作者姓名           修改时间           版本号            描述
*/


import com.baomidou.dynamic.datasource.annotation.DS;
import com.mdb.bc.api.data.ResultEx;
import com.mdb.bc.database.mybatisplus.SuperService;
import com.mdb.open.trade.common.MdbDataSource;
import com.mdb.open.trade.domain.bo.trade.LoanApplyTransportInfoBo;
import com.mdb.open.trade.domain.po.trade.LoanApplyTransportInfo;
import com.mdb.open.trade.mapper.trade.TfLoanApplyTransportInfoMapper;
import org.springframework.stereotype.Service;

/**
 * 类描述：
 *  贸易融资申请运输信息表 服务类
 *
 * @author you.yichao
 * @date 2019-10-11
 */
@Service
@DS(MdbDataSource.TRADE)
public class TfLoanApplyTransportInfoService extends SuperService<TfLoanApplyTransportInfoMapper, LoanApplyTransportInfo> {

    public ResultEx saveTransportInfo(LoanApplyTransportInfoBo transportInfoBo) {
        LoanApplyTransportInfo info = new LoanApplyTransportInfo();
        info.setApplyOrderNo(transportInfoBo.getApplyOrderNo());
        info.setBusinessNo(transportInfoBo.getBusinessNo());
        info.setApplyOrderCustomsNo(transportInfoBo.getApplyOrderCustomsNo());
        info.setCustomsNo(transportInfoBo.getCustomsNo());
        info.setCustomerName(transportInfoBo.getCustomerName());
        info.setCustomerCode(transportInfoBo.getCustomerCode());
        info.setMcustomerCode(transportInfoBo.getMcustomerCode());
        info.setMerchantNo(transportInfoBo.getMerchantNo());
        info.setMerchantName(transportInfoBo.getMerchantName());
        info.setLadingBillNo(transportInfoBo.getLadingBillNo());
        info.setShipper(transportInfoBo.getShipper());
        info.setContainerNo(transportInfoBo.getContainerNo());
        info.setReceiverCnName(transportInfoBo.getReceiverCnName());
        info.setReceiverEnName(transportInfoBo.getReceiverEnName());
        info.setShipLoadTime(transportInfoBo.getShipLoadTime());
        info.setReceiverCountry(transportInfoBo.getReceiverCountry());
        info.setTransportType(transportInfoBo.getTransportType());
        info.setTransportName(transportInfoBo.getTransportName());
        info.setStatus(transportInfoBo.getStatus());
        info.setSourceType(transportInfoBo.getSourceType());

        int count = this.baseMapper.insert(info);
        if (count != 1) {
            return ResultEx.fail();
        }
        return ResultEx.ok();
    }

}
